package storage

type AccountType struct {
	Type[AccountStaticType, AccountDynamicsType]
}

type AccountUnitType = UnitType[AccountStaticType, AccountDynamicsType]

type AccountStaticType struct {
	Nick     string `form:"nick" bson:"nick" json:"nick"`
	Username string `form:"username" bson:"username" json:"username"`
	Password string `form:"password" bson:"password" json:"password"`
}

type AccountDynamicsType struct {
}

func (_self *AccountType) ExistedByName(username string) (result *UnitType[AccountStaticType, AccountDynamicsType]) {

	_self.foreach(nil, func(stop *bool, index *int, item *UnitType[AccountStaticType, AccountDynamicsType]) {

		if item.Static.Username == username {
			result = item
			*stop = true
		}
	})

	return
}
